<!--
- Author:  LiShibin.
- Date:    2017/7/4 0004.
- File:    my.
-->
<template>
    <div class="Web_Box">
        <div class="Topmenu"><i @click="back" class="iconfont icon-youjiantou"><a href=""></a></i>
            <h1>余额提现</h1>
            <span></span>
        </div>
        <div class="tixianjine">
            <span>提现金额</span>
            <input type="number" v-model="bankwithdrawal.withdrawals_amount" placeholder="请填写提现金额">
        </div>
        <div class="tixianweizhi">
            <ul>
                <li>
                    提现到
                </li>
                <li :class="{'on': payType == 2}" @click="switchPayType(1)">
                    <span class="tixianweizhiimg"><img src="../../assets/images/yl.png" alt=""></span>
                    <span class="tixianwiezhifs">银行卡</span>
                    <i class="iconfont icon-xuanzhong1" :class="{'zzz': payType == 1}"></i>
                </li>
                <!--<li>-->
                    <!--<span class="tixianweizhiimg"><img src="../../assets/images/weixinlogo.png" alt=""></span>-->
                    <!--<span class="tixianwiezhifs">微信支付</span>-->
                    <!--<i class="iconfont icon-xuanzhong1"></i>-->
                <!--</li>-->
            </ul>
        </div>
        <div class="tixianweizhibtn" @click="save">确认提现</div>
    </div>
</template>

<script>

  export default{
    data() {
      return {
        from: this.$route.query.from || '',
        bankwithdrawal: {
          withdrawals_amount: '',
          type: ''
        },
        payType: 0
      }
    },
    methods: {
      switchPayType(type) {
        this.payType = type
        this.bankwithdrawal.type = type
      },
      back() {
        this.$router.go(-1)
      },
      save() {
        let restMoney = this.bankwithdrawal.withdrawals_amount % 100 // 余数
        if (restMoney > 0) {
          this.$toast('提现金额需为100的倍数')
          return
        }
        this.$request.withdrawal(this.bankwithdrawal, this.payType).then(data => {
          this.$toast('提现申请成功')
          this.$router.go(-1)
        })
      }
    }
  }
</script>
<style>
    .zzz {
        color: #e3c143 !important;
    }
</style>
